﻿Imports FRAMEWORK
Imports System.Data.SqlClient
Public Class UserPermission
    Public Shared _IsView As Boolean = False
    Public Shared _IsAdd As Boolean = False
    Public Shared _IsEdit As Boolean = False
    Public Shared _IsDel As Boolean = False
    Public Shared _IsPrint As Boolean = False
    Public Shared _IsApprove As Boolean = False


    

    Public Shared Sub getPermission(ByVal menu As String, ByVal user As Integer)
        Dim DA As New SQLDataAccess
        Dim dt As DataTable
        Dim dr As DataRow
        Dim para(1) As SqlParameter
        para(0) = New SqlParameter("@ACTION", 1)
        para(1) = New SqlParameter("@User_ID", user)
        'para(2) = New SqlParameter("@menuID", 0)
        'para(3) = New SqlParameter("@Employee_Code", " ")
        dt = DA.ExecuteDataset(CommandType.StoredProcedure, "sp_GetAllMenu", para).Tables(0)
        If (dt.Rows.Count > 0) Then
            For Each dr In dt.Rows
                If dr("MN_Code").ToString() = menu Then
                    _IsView = dr("IsView")
                    _IsAdd = dr("IsInsert")
                    _IsEdit = dr("IsEdit")
                    _IsDel = dr("IsDel")
                    _IsPrint = dr("IsPrint")
                    _IsApprove = dr("Is_Approve")
                End If
            Next
        End If


    End Sub


End Class
